#include "stdafx.h"
#include "Event.h"

#ifdef WIN32
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif //_DEBUG
#endif //WIND32

namespace serika
{
	namespace ut
	{
		Event::EventPool Event::mEventPool;

		Event::Event()
			: mUserData(0)
			, mType(0)
			, mCode(0)
		{
		}

		Event::~Event()
		{
		}

		Event* Event::NewEvent()
		{
			Event* e = Event::mEventPool.Alloc();
			e->Reset();
			return e;
		}

		Event* Event::NewEvent(int type, int code)
		{
			Event* e = NewEvent();
			e->Reset();
			e->SetType(type);
			e->SetCode(code);
			return e;
		}

		void Event::Release()
		{
			Event::mEventPool.Free(this);
		}

		void Event::Reset()
		{
			mUserData = 0;
			mType = 0;
			mCode = 0;
		}
	}
}
